<template>
  <div>
    <div class="label-tag">
      <div class="batchImportTop">
        <p v-for="(item, index) in tips" :key="index"><span>{{ index + 1 }}.</span><i>{{ item }}</i></p>
        <a :href="authUrl + '/template/' + demoName + '?t=' + new Date().getTime()">
          <img src="@/assets/images/common/updata_icon.png" />下载模版</a>
      </div>
      <up-file
        :multiple="false"
        :limit="1"
        :accept="'.xls,.xlsx'"
        btn-width="100%"
        :upload-tip="'仅支持Excel文件（xls，xlsx）,文件不超过5M'"
        :data-json="{ type: importType }"
        @changeFile="changeFile"
      />
    </div>
  </div>
</template>

<script>

import UpFile from '@/components/Upload/UpFile.vue'
export default {
  components: {
    UpFile
  },
  props: {
    importType: {
      type: String,
      default: '1'
    },
    demoName: {
      type: String,
      default: '批量下单模板.xls'
    },
    tips: {
      type: Array,
      default: () => ['必须使用系统提供的模板', '仅支持Excel文件（xls，xlsx），数据必须放在第一个 sheet', '上传表格最多不超过5000行，文件不超过5M']
    }
  },

  data() {
    return {
      authUrl: window.config.getAuthUrl().baseUrl,
      loading: false
    }
  },

  mounted() {

  },

  methods: {
    cancel() {
      this.$emit('dataBatchCancel')
    },
    changeFile(fileList) {
      this.$emit('changeFile', fileList)
    }

  }
}
</script>

<style scoped>
.batchImportTop {
    width: 100%;
    background: #F7F8FA;
    border-radius: 6px 6px 6px 6px;
    box-sizing: border-box;
    padding: 12px;
    margin-bottom: 26px;
}

.batchImportTop p {
    width: 100%;
    margin: 0;
    margin-bottom: 10px;
    font-size: 12px;
    color: #3D3D3D;
    line-height: 25px;
    display: flex;
}

.batchImportTop p span {
    color: #37A6E5;
    display: block;
}

.batchImportTop p i {
    font-style: normal;
    display: block;
}

.batchImportTop a {
    width: 120px;
    height: 32px;
    background: #FFFFFF;
    border-radius: 2px 2px 2px 2px;
    opacity: 1;
    /* text-align: center; */
    font-size: 14px;
    color: #37A6E5;
    display: flex;
    line-height: 32px;
    align-items: center;
    justify-content: center;
}

.batchImportTop a img {
    display: block;
    width: 16px;
    height: 16px;
    margin-right: 4px;
}
</style>
